using Gobang;
using MCTS;
using TMPro;
using UnityEngine;

public class ValueDetector : MonoBehaviour
{
#if UNITY_EDITOR
    public TextMeshProUGUI tmp;
    private ChessboardMono chessboard;

    private void Awake()
    {
        chessboard = ChessboardMono.FindInstance();
    }

    private void Update()
    {
        Vector3 world = Camera.main.ScreenToWorldPoint(Input.mousePosition);
        Vector2Int action = chessboard.WorldToChess(world);
        if (ChessboardUtility.Contain(chessboard.size, action))
            tmp.text = MCTSUtility.CalculateValue(chessboard.Chessboard.board, chessboard.Chessboard.chesses.Count, action, chessboard.nextChess, true).ToString("f2");
    }
#endif
}
